package com.beyond.trace.dy.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.beyond.trace.dy.mapper.TraceDyOrderMapper;
import com.beyond.trace.dy.domain.TraceDyOrder;
import com.beyond.trace.dy.service.ITraceDyOrderService;

/**
 * 采购订单Service业务层处理
 * 
 * @author Mr.Yao
 * @date 2022-04-09
 */
@Service
public class TraceDyOrderServiceImpl extends ServiceImpl<TraceDyOrderMapper, TraceDyOrder> implements ITraceDyOrderService
{
    @Resource
    private TraceDyOrderMapper traceDyOrderMapper;

    /**
     * 查询采购订单
     * 
     * @param orderId 采购订单ID
     * @return 采购订单
     */
    @Override
    public TraceDyOrder selectTraceDyOrderById(Long orderId)
    {
        return traceDyOrderMapper.selectTraceDyOrderById(orderId);
    }

    /**
     * 查询采购订单列表
     * 
     * @param traceDyOrder 采购订单
     * @return 采购订单
     */
    @Override
    public List<TraceDyOrder> selectTraceDyOrderList(TraceDyOrder traceDyOrder)
    {
        return traceDyOrderMapper.selectTraceDyOrderList(traceDyOrder);
    }

    /**
     * 新增采购订单
     * 
     * @param traceDyOrder 采购订单
     * @return 结果
     */
    @Override
    public boolean insertTraceDyOrder(TraceDyOrder traceDyOrder)
    {
        traceDyOrder.setCreateTime(DateUtils.getNowDate());
        //return traceDyOrderMapper.insertTraceDyOrder(traceDyOrder);
        return super.save(traceDyOrder);
    }

    /**
     * 修改采购订单
     * 
     * @param traceDyOrder 采购订单
     * @return 结果
     */
    @Override
    public int updateTraceDyOrder(TraceDyOrder traceDyOrder)
    {
        traceDyOrder.setUpdateTime(DateUtils.getNowDate());
        return traceDyOrderMapper.updateTraceDyOrder(traceDyOrder);
    }

    /**
     * 批量删除采购订单
     * 
     * @param orderIds 需要删除的采购订单ID
     * @return 结果
     */
    @Override
    public int deleteTraceDyOrderByIds(Long[] orderIds)
    {
        return traceDyOrderMapper.deleteTraceDyOrderByIds(orderIds);
    }

    /**
     * 删除采购订单信息
     * 
     * @param orderId 采购订单ID
     * @return 结果
     */
    @Override
    public int deleteTraceDyOrderById(Long orderId)
    {
        return traceDyOrderMapper.deleteTraceDyOrderById(orderId);
    }
}
